﻿<div class="container-12 clearfix">
    <div class="grid-12">
        <div class="sk-passport-register-step sk-passport-register-step-alpha m-30">
        </div>
    </div>
    <div class="grid-12">
        <div class="grid-6 alpha">
            <div class="sk-passport-register">
                @using (Html.BeginForm())
                {
                    <div class="main m-30">
                        <ul class="clearfix">
                            <li>
                                <label>
                                    用户名：</label><input type="text" id="username" name="username" class="sk-ui-input" />
                            </li>
                            <li>
                                <label>
                                    密码：</label><input type="text" id="password" name="password" class="sk-ui-input" />
                            </li>
                            <li>
                                <label>
                                    确认密码：</label><input type="text" id="repassword" name="repassword" class="sk-ui-input" />
                            </li>
                            <li>
                                <label>
                                    验证码：</label><input type="text" name="captcha" class="sk-ui-input sk-ui-input-captcha"
                                        maxlength="4" />
                                <img class="sk-passport-login-captcha-img" src="/register/captcha" onclick="this.src='/register/captcha?'+Math.random();"
                                    alt="点击刷新" />
                            </li>
                            <li>点击“同意并注册”，即表示您同意 <a href="###">用户使用协议</a> </li>
                            <li>
                                <button type="reset" class="sk-ui-btn sk-ui-btn-beta">
                                    重 置
                                </button>
                                <button type="submit" class="sk-ui-btn sk-ui-btn-alpha">
                                    同意并注册</button>
                            </li>
                            <li>
                                <div id="register-message">
                                </div>
                            </li>
                        </ul>
                    </div>
                }</div>
        </div>
        <div class="grid-6 omega">
            asfasf
        </div>
    </div>
</div>
@section header{
}
@section css{
    @Url.Sk().StaticCss("sk.passport")
}
@section js{
    <script type="text/javascript">
        $(function () {
            //$('.captcha').captcha();
            $("#username").keyup(function () {
                var val = this.value;
                if (val.indexOf('@@') >= 0) {
                    val = val.substring(0, val.indexOf('@@'));
                }
                var availableTags = [val + "@@qq.com", val + "@@163.com", val + "@@sina.com", val + "@@sohu.com", val + "@@yahoo.cn", val + "@@gmail.com", val + "@@hotmail.com"];
                $(this).autocomplete({
                    source: availableTags
                });
            });
            $('form').validate({
                rules: { 'username': { required: true, email: true }, 'password': { required: true, password: true }, 'repassword': { required: true, password: false, equalTo: "#password" }, 'captcha': { required: true, rangelength: [4, 4]} },
                messages: { 'username': { required: '请输入邮箱！', email: '请输入邮箱！' }, password: { required: '请输入密码！', password: '请输入符合格式的密码！' }, repassword: { required: '请输入确认密码！', password: '请输入确认密码！', equalTo: "两次输入密码不一致！" }, 'captcha': { required: '请输入验证码!', rangelength: '请输入验证码!'} },
                submitHandler: function (form) {
                    var param = $(form).serialize();
                    $.postJSON(form.action, param, function (result) {
                        if (result.Status == true) {
                            var html = $.format("<a href='javascript:void(0);' onclick='reSend(\"{0}\");'>重新发送</a>", result.Message);
                            $("#register-message").html(html);
                        }
                        else {
                            $("#register-message").html(result.Message);
                        }
                    });
                    return false;
                }
            });
        });
        function reSend(guid) {
            var url = "/register/resend";
            $.postJSON(url, { param: guid }, function (result) {
                if (result.Status == true) {
                    alert(0);
                }
                else {

                }
            });
        }
    </script>
}
